<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>工作经历</h2>
    <hr>
    <div id="0">
       

    </div>
    <p onclick="addson()">添加工作经历</p>
    <button onclick="ks()">开始</button>
</body>
<script>

  
function addson(){
        var divone = document.getElementById('0');
        var divtwo = document.createElement('div');
        
        for(var p=0;p<100;p++){
            if(document.getElementById(p)==null){
                divtwo.id=p;
                divtwo.value=p;
                var k=p;
                break;
            }
        }
        
        console.log(k)
       
        var ppp = `
          工作公司名称:<input type="text">
        职位：<input type="text">
        <p  onclick="deleteson()" id="1" name="lk">删除工作经历</p>
        
        <table>
            <tr>
                <td><工作经历及工作职责：</td>
                <td> <textarea name="" id="" cols="50" rows="8"></textarea></td>
            </tr>
        </table>
        <hr>
        `
        ;
        
        divtwo.innerHTML = ppp;
        divone.appendChild(divtwo);
        
        document.getElementsByName('lk').id=k;
        // for(var p=0;p<100;p++){
        //     if(document.getElementById(p)==null){
                
        //         var a = document.getElementsByTagName('p')
        //         var n = p-1;
        //         a[n].setAttribute('abc',p);
        //         break;
        //     }
        // }
        
    }
    function deleteson(){
        var divone = document.getElementById('div1');
        
        // for(varm=0;m<100;m++){
        //     if(==m){
        //         var divtwo = document.getElementById(m);
        //         divone.removeChild(divtwo);
        //     }
                
        // }
        
    }
    
    
 
    
</script>
</html>